﻿#region 信息
// Copyright©2014 Rex Rao all rights reserved.
// File name : Mojito\Mojito.Data\AccountItemConfiguration.cs
// Author : Sohobloo
// Create time : 2014/08/28 16:48
// Update time : 2014/08/28 16:48
#endregion

using System.ComponentModel.DataAnnotations.Schema;

namespace Mojito.Data.Configuration
{
    internal sealed partial class AccountItemConfiguration
    {
        protected override void ConfigurateExtension()
        {
            Property(ai => ai.SerialNumber).HasDatabaseGeneratedOption(DatabaseGeneratedOption.Identity);
            Property(ai => ai.Notes).HasMaxLength(1000);
            HasRequired(ai => ai.Account).WithMany(a => a.AccountItems).HasForeignKey(ai => ai.AccountId);
            HasRequired(ai => ai.Category).WithMany().HasForeignKey(ai => ai.CategoryId);
            HasOptional(ai => ai.Order).WithMany().HasForeignKey(ai => ai.OrderId);
        }
    }
}